package demo1;

public class Person implements Cloneable{ //实现Cloneable空接口，标记可克隆，使用super.clone(）防止抛出异常
    String name;
    public Person  clone() throws CloneNotSupportedException{
        return (Person)super .clone();//使用父类Object的clone方法强制转为Person类
    };
    public  Person(String name){
        this.name=name;
    }
}
